function download() {
    // 通过 API 获取目标 canvas 元素
    const el = document.createElement('a');
    // 设置 href 为图片经过 base64 编码后的字符串，默认为 png 格式
    el.href = canvas.toDataURL('image/png');
    el.download = 'DownFile';
    // 创建一个点击事件并对 a 标签进行触发
    const event = new MouseEvent('click');
    el.dispatchEvent(event);
}
function onOpenCvReady() { //加载opencv.js成功情况
    document.getElementById('status').innerHTML = '<b>OpenCV.js is ready</b>.' +
        'You can upload an image.<br>' +
        'The <b>imageSrc</b> is a &lt;img&gt; element used as cv.Mat input. ' +
        'The <b>canvasOutput</b> is a &lt;canvas&gt; element used as cv.Mat output.';
}
function onOpenCvError() { //加载opencv.js出错情况
    let element = document.getElementById('status');
    element.setAttribute('class', 'err');
    element.innerHTML = 'Failed to load opencv.js';
}
